package com.cskaoyan.javase.oop3._1interface._3exercise;

/**
 * 1. 教练（Coach）和运动员（Sportsman）案例
 *  小试牛刀请用所学知识分析：这个案例中有哪些抽象类，哪些接口，哪些具体类。
 *
 * 现在有乒乓球运动员和篮球运动员，乒乓球教练和篮球教练。
 * 为了能够出国交流，跟乒乓球相关的人员都需要学习英语。
 *
 * 抽象类：运动员和教练
 * 接口：学习
 *
 * @since 16:09
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Demo {
    public static void main(String[] args) {
        // AbstractSportsman
        // ILearning
        TableTennisSportsman tts = new TableTennisSportsman(18, "张三");
    }
}

abstract class AbstractSportsman {
    private int age;
    private String name;

    public abstract void play();

    public AbstractSportsman() {
    }

    public AbstractSportsman(int age, String name) {
        this.age = age;
        this.name = name;
    }
}

abstract class AbstractCoach {
    private int age;
    private String name;
    private double salary;

    public abstract void teach();

    public AbstractCoach() {
    }

    public AbstractCoach(int age, String name, double salary) {
        this.age = age;
        this.name = name;
        this.salary = salary;
    }
}

interface ILearning {
    void studyEnglish(double money);
}

class TableTennisSportsman extends AbstractSportsman implements ILearning {

    @Override
    public void play() {
        System.out.println("我打乒乓球！");
    }

    @Override
    public void studyEnglish(double money) {
        System.out.println("我花钱学英语！");
    }

    public TableTennisSportsman() {
    }

    public TableTennisSportsman(int age, String name) {
        super(age, name);
    }
}

class BasketballCoach extends AbstractCoach {
    @Override
    public void teach() {
        System.out.println("我教你打篮球！");
    }

    public BasketballCoach() {
    }

    public BasketballCoach(int age, String name, double salary) {
        super(age, name, salary);
    }
}